package com.qyhl.webtv.module_news.news.smallvideo.detail;


import com.qyhl.webtv.commonlib.entity.news.CatchSmallBean;

import java.util.List;

/**
 * Created by qyhl on 2017/12/7.
 */

public class SmallVideoDetailPresenter implements SmallVideoDetailContract.SmallVideoDetailPresenter {
    private SmallVideoDetailContract.SmallVideoDetailView mView;

    private SmallVideoDetailModel mModel;

    SmallVideoDetailPresenter(SmallVideoDetailContract.SmallVideoDetailView mView) {
        this.mView = mView;
        this.mModel = new SmallVideoDetailModel(this);
    }
    @Override
    public void getDetail(String newsId) {
        mModel.getDetail(newsId);
    }

    @Override
    public void getComment(String page, String number, String newsId) {
        mModel.getComment(page, number, newsId);
    }

    @Override
    public void sendComment(String newsId, String content, String userName, String nickName, String userAvatar) {
        mModel.sendComment(newsId, content, userName, nickName, userAvatar);
    }

    @Override
    public void count(String newsId) {
        mModel.count(newsId);
    }

    @Override
    public void setDetail(CatchSmallBean bean) {
        mView.setDetail(bean);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.setError(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            default:break;
        }
    }

    @Override
    public void setComment(List<CatchSmallBean.Comments> beanList, boolean isMore) {
        mView.setComment(beanList, isMore,false);
    }

    @Override
    public void setCommentError(String msg) {
        mView.setCommentError(msg);
    }

    @Override
    public void setCommentEmpty(String msg) {
        mView.setCommentEmpty(msg);
    }

    @Override
    public void setCommentMessage(String msg) {
        mView.setCommentMessage(msg);
    }

    @Override
    public void setLog(String msg) {
        mView.setLog(msg);
    }

    @Override
    public void sendSuccess(String msg) {
        mView.sendSuccess(msg);
    }

    @Override
    public void sendError(String msg) {
        mView.sendError(msg);
    }

}
